package za.co.chris.traintimes.database.management;

import static za.co.chris.traintimes.database.DatabaseConstants.DATABASE_NAME;
import static za.co.chris.traintimes.database.DatabaseConstants.DATABASE_VERSION;
import static za.co.chris.traintimes.database.DatabaseConstants.TIMES_TABLE_CREATE;
import static za.co.chris.traintimes.database.DatabaseConstants.TIME_TABLE;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class TimeTable extends SQLiteOpenHelper {

	TimeTable(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(TIMES_TABLE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TIME_TABLE);
		onCreate(db);
	}
}
